<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="custom-style.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
	<div style="overflow: hidden;">
		<div style="height: 57px;min-width: 1039px;background-size: auto 100%;background:url('');">
			<img src="titleleft.png" style="float: left;"/>
			<img src="titleright.png" alt="" style="float: right;" />
		</div>
	</div>
<!-- 制作者 Doxygen 1.8.15 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>法律声明</span></a></li>
      <li><a href="_xE9_xA6_x96_xE9_xA1_xB5.html"><span>首页</span></a></li>
      <li><a href="_xE6_x9B_xB4_xE6_x96_xB0_xE8_xAE_xB0_xE5_xBD_x95.html"><span>更新记录</span></a></li>
      <li><a href="_xE7_x8E_xAF_xE5_xA2_x83_xE9_x85_x8D_xE7_xBD_xAE.html"><span>环境配置</span></a></li>
      <li><a href="_xE7_xBC_x96_xE7_xA8_x8B_xE5_xBC_x95_xE5_xAF_xBC.html"><span>编程引导</span></a></li>
      <li><a href="modules.html"><span>接口说明</span></a></li>
      <li><a href="annotated.html"><span>结构体定义</span></a></li>
      <li><a href="_xE7_x9B_xB8_xE6_x9C_xBA_xE5_x8F_x82_xE6_x95_xB0_xE8_x8A_x82_xE7_x82_xB9_xE8_xA1_xA8.html"><span>相机参数节点表</span></a></li>
      <li><a href="examples.html"><span>示例程序</span></a></li>
      <li><a href="_xE9_x94_x99_xE8_xAF_xAF_xE7_xA0_x81.html"><span>状态码</span></a></li>
      <li><a href="_xE5_xB8_xB8_xE8_xA7_x81_xE9_x97_xAE_xE9_xA2_x98.html"><span>常见问题</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">HighBandwithDecode.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<p>高清无损压缩</p>
<p>该示例程序演示通过高清无损压缩算法将从相机取到的无损压缩码流解码成裸数据。</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;unistd.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><span class="preprocessor">#include &quot;MvCameraControl.h&quot;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#define IMAGE_NAME_LEN 256</span></div><div class="line"></div><div class="line"><span class="keywordtype">bool</span> IsHBPixelFormat(<a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#ga94f17d82a2c13785d0085217e9204061">MvGvspPixelType</a> enType)</div><div class="line">{</div><div class="line">    <span class="keywordflow">switch</span>(enType)</div><div class="line">    {</div><div class="line">    <span class="keywordflow">case</span> <a name="a0"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a3a9beb043313bdf89295e8ae1d694587">PixelType_Gvsp_HB_Mono8</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a1"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a00c14d1ed51890762c7b62919d8f201c">PixelType_Gvsp_HB_Mono10</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a2"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061aa0ae063de349d4d102e0da8152adcd5a">PixelType_Gvsp_HB_Mono10_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a3"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a7ed95158142e793b8391386bd7c5d3d1">PixelType_Gvsp_HB_Mono12</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a4"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061afb425564a433b5a59b725ce2618e7b61">PixelType_Gvsp_HB_Mono12_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a5"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a526fc0b360faf771431ed686ab3c2f29">PixelType_Gvsp_HB_Mono16</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a6"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a12e5b0fc9251700a39602b48ef0316bd">PixelType_Gvsp_HB_RGB8_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a7"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a1dad5922450643c405a8fafbeea31ad6">PixelType_Gvsp_HB_BGR8_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a8"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a974424545e0831852ca0cd5d6ea543f0">PixelType_Gvsp_HB_RGBA8_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a9"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061ac451df05308f2808969926cb7f5e9d44">PixelType_Gvsp_HB_BGRA8_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a10"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061ab005b4dba6067633b923767c89bf539e">PixelType_Gvsp_HB_RGB16_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a11"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061aeb1e1a12065339151222295de4e45fa4">PixelType_Gvsp_HB_BGR16_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a12"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061ad22f4f7b1dca2cc470ef961e49faab3d">PixelType_Gvsp_HB_RGBA16_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a13"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061ac88d62a96bfb765da6a6af690c7e39a5">PixelType_Gvsp_HB_BGRA16_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a14"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a1152e561abd1e5a9c3cbdbdcaab196d4">PixelType_Gvsp_HB_YUV422_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a15"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061ad0586d59b459a0752ee58180caaa6db1">PixelType_Gvsp_HB_YUV422_YUYV_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a16"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061ac5bcff9fb16f02601a461086bd101237">PixelType_Gvsp_HB_BayerGR8</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a17"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a07229ae0821583b466f27f048b566351">PixelType_Gvsp_HB_BayerRG8</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a18"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061af78eaba15dba03f2ba1b7d3c30474479">PixelType_Gvsp_HB_BayerGB8</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a19"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a5379312c13ca968aec0c6a03157d377c">PixelType_Gvsp_HB_BayerBG8</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a20"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061acbb88f63f363909546918631e0543ad6">PixelType_Gvsp_HB_BayerRBGG8</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a21"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a9b156e35c41b9f97268120f501894ff3">PixelType_Gvsp_HB_BayerGB10</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a22"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061ad09559bee6ea92e5dd7fb569f8fbe6e4">PixelType_Gvsp_HB_BayerGB10_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a23"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061aa124103494b1c0d541e8e0bd453a28ab">PixelType_Gvsp_HB_BayerBG10</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a24"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a35ae1c25dea98c2a2fe31a46a78b5aa6">PixelType_Gvsp_HB_BayerBG10_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a25"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a6d483b5e8a0297c370e25659c70b38d8">PixelType_Gvsp_HB_BayerRG10</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a26"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061af8fe7910f97e52a436524279e4cfa1b7">PixelType_Gvsp_HB_BayerRG10_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a27"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a1fa6e8ea1e4f0d9ec19d5d97f6351efa">PixelType_Gvsp_HB_BayerGR10</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a28"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a0f1879907585095aa3ae5b40fcbd1966">PixelType_Gvsp_HB_BayerGR10_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a29"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a5efd3944502d4c6f934e4968af9c6e56">PixelType_Gvsp_HB_BayerGB12</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a30"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061ada106a75ed6b31585d1563b282ffae3e">PixelType_Gvsp_HB_BayerGB12_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a31"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061aba561dc2421ed0a2ad2f905b9b9f997f">PixelType_Gvsp_HB_BayerBG12</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a32"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a5f71a9ded32f37282030c2b041df09ec">PixelType_Gvsp_HB_BayerBG12_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a33"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a315b573b5ff4f5fbdf4e2eb50c014c11">PixelType_Gvsp_HB_BayerRG12</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a34"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061a85f40adc8e5f7107556fe6ca60e1fca8">PixelType_Gvsp_HB_BayerRG12_Packed</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a35"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061adbddf77ced43ccedfa7d6052ba7605ee">PixelType_Gvsp_HB_BayerGR12</a>:</div><div class="line">    <span class="keywordflow">case</span> <a name="a36"></a><a class="code" href="group___xE7_xB1_xBB_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gga94f17d82a2c13785d0085217e9204061adca13668f50b22f5d830d4cf96cb3dc0">PixelType_Gvsp_HB_BayerGR12_Packed</a>:</div><div class="line">        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line">    <span class="keywordflow">default</span>:</div><div class="line">        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line">    }</div><div class="line">}</div><div class="line"><span class="comment">// ch:等待用户输入enter键来结束取流或结束程序</span></div><div class="line"><span class="comment">//en:wait for user to input enter to stop grabbing or end the sample program</span></div><div class="line"><span class="keywordtype">void</span> PressEnterToExit(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <span class="keywordtype">int</span> c;</div><div class="line">    <span class="keywordflow">while</span>((c = getchar()) != <span class="charliteral">&#39;\n&#39;</span> &amp;&amp; c != EOF);</div><div class="line">    fprintf(stderr, <span class="stringliteral">&quot;\nPress enter to exit.\n&quot;</span>);</div><div class="line">    <span class="keywordflow">while</span>(getchar() != <span class="charliteral">&#39;\n&#39;</span>);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">bool</span> PrintDeviceInfo(<a name="_a37"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html">MV_CC_DEVICE_INFO</a>* pstMVDevInfo)</div><div class="line">{</div><div class="line">    <span class="keywordflow">if</span>(NULL == pstMVDevInfo)</div><div class="line">    {</div><div class="line">        printf(<span class="stringliteral">&quot;The Pointer of pstMVDevInfo is NULL&quot;</span>);</div><div class="line">        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (pstMVDevInfo-&gt;<a name="a38"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#a3b26b1c9681dba57af81bdb7ed795575">nTLayerType</a> == <a name="a39"></a><a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#gae1780ad0d41bcd2e835ab81155b398e6">MV_GIGE_DEVICE</a>)</div><div class="line">    {</div><div class="line">        <span class="keywordtype">int</span> nIp1 = ((pstMVDevInfo-&gt;<a name="a40"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a name="a41"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a name="a42"></a><a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aea1e6f183f4d5cf372af1add35691563">nCurrentIp</a> &amp; 0xff000000) &gt;&gt; 24);</div><div class="line">        <span class="keywordtype">int</span> nIp2 = ((pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aea1e6f183f4d5cf372af1add35691563">nCurrentIp</a> &amp; 0x00ff0000) &gt;&gt; 16);</div><div class="line">        <span class="keywordtype">int</span> nIp3 = ((pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aea1e6f183f4d5cf372af1add35691563">nCurrentIp</a> &amp; 0x0000ff00) &gt;&gt; 8);</div><div class="line">        <span class="keywordtype">int</span> nIp4 = (pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aea1e6f183f4d5cf372af1add35691563">nCurrentIp</a> &amp; 0x000000ff);</div><div class="line"></div><div class="line">        <span class="comment">// ch:打印当前相机ip和用户自定义名字 | en:print current ip and user defined name</span></div><div class="line">        printf(<span class="stringliteral">&quot;Device Model Name: %s\n&quot;</span>, pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a name="a43"></a><a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#a0444c9bb101455ec9303a2c0cf9052c1">chModelName</a>);</div><div class="line">        printf(<span class="stringliteral">&quot;CurrentIp: %d.%d.%d.%d\n&quot;</span> , nIp1, nIp2, nIp3, nIp4);</div><div class="line">        printf(<span class="stringliteral">&quot;UserDefinedName: %s\n\n&quot;</span> , pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#aab5fcc9de5a7fa798f170a8453818cc5">stGigEInfo</a>.<a name="a44"></a><a class="code" href="struct_m_v___g_i_g_e___d_e_v_i_c_e___i_n_f_o.html#aae7ffce31c7dd8e1c98aab32776e5080">chUserDefinedName</a>);</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#a3b26b1c9681dba57af81bdb7ed795575">nTLayerType</a> == <a name="a45"></a><a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#ga356c3a2b4efad3bea955ecb54e1632fe">MV_USB_DEVICE</a>)</div><div class="line">    {</div><div class="line">        printf(<span class="stringliteral">&quot;Device Model Name: %s\n&quot;</span>, pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a name="a46"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#a3bea622a6d4adb297c2a8c99f28c54eb">stUsb3VInfo</a>.<a name="a47"></a><a class="code" href="struct_m_v___u_s_b3___d_e_v_i_c_e___i_n_f_o.html#a1fd78924df9302fb6421706ddb10c6db">chModelName</a>);</div><div class="line">        printf(<span class="stringliteral">&quot;UserDefinedName: %s\n\n&quot;</span>, pstMVDevInfo-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#ad8047fbdb096b8801b869f00db151c69">SpecialInfo</a>.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#a3bea622a6d4adb297c2a8c99f28c54eb">stUsb3VInfo</a>.<a name="a48"></a><a class="code" href="struct_m_v___u_s_b3___d_e_v_i_c_e___i_n_f_o.html#a5749014e9a3d16bdca2d0cfb9f1f7e16">chUserDefinedName</a>);</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        printf(<span class="stringliteral">&quot;Not Sopport.\n&quot;</span>);</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">    <span class="keywordtype">int</span> nRet = MV_OK;</div><div class="line">    <span class="keywordtype">void</span>* handle = NULL;</div><div class="line">    <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* pDstBuf = NULL;</div><div class="line">    <span class="keywordtype">bool</span> isDevOpen = <span class="keyword">false</span>;</div><div class="line">    <span class="keywordflow">do</span> </div><div class="line">    {</div><div class="line">        <span class="comment">// ch:初始化SDK | en:Initialize SDK</span></div><div class="line">        nRet = <a name="a49"></a><a class="code" href="group___s_d_k_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga768544eb6e6435313dd99ee9cf92d59d">MV_CC_Initialize</a>();</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Initialize SDK fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <a name="_a50"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html">MV_CC_DEVICE_INFO_LIST</a> stDeviceList;</div><div class="line">        memset(&amp;stDeviceList, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html">MV_CC_DEVICE_INFO_LIST</a>));</div><div class="line"></div><div class="line">        <span class="comment">//ch:枚举设备 | en:enum device</span></div><div class="line">        nRet = <a name="a51"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga88741869e2b3c12e47025e53e6a7b58b">MV_CC_EnumDevices</a>(<a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#gae1780ad0d41bcd2e835ab81155b398e6">MV_GIGE_DEVICE</a> | <a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#ga356c3a2b4efad3bea955ecb54e1632fe">MV_USB_DEVICE</a>, &amp;stDeviceList);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;MV_CC_EnumDevices fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        <span class="keywordflow">if</span> (stDeviceList.<a name="a52"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#a757ade91f37b0c95b768035d0ec07fdc">nDeviceNum</a> &gt; 0)</div><div class="line">        {</div><div class="line">            <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#a757ade91f37b0c95b768035d0ec07fdc">nDeviceNum</a>; i++)</div><div class="line">            {</div><div class="line">                printf(<span class="stringliteral">&quot;[device %d]:\n&quot;</span>, i);</div><div class="line">                <a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html">MV_CC_DEVICE_INFO</a>* pDeviceInfo = stDeviceList.<a name="a53"></a><a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[i];</div><div class="line">                <span class="keywordflow">if</span>(NULL == pDeviceInfo)</div><div class="line">                {</div><div class="line">                    <span class="keywordflow">break</span>;</div><div class="line">                }</div><div class="line">                PrintDeviceInfo(pDeviceInfo);</div><div class="line">            }</div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span></div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Find No Devices!\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        printf(<span class="stringliteral">&quot;Please Input camera index(0-%d):&quot;</span>, stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#a757ade91f37b0c95b768035d0ec07fdc">nDeviceNum</a>-1);</div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nIndex = 0;</div><div class="line">        scanf(<span class="stringliteral">&quot;%d&quot;</span>, &amp;nIndex);</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span>(nIndex &gt;= stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#a757ade91f37b0c95b768035d0ec07fdc">nDeviceNum</a>)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;InPut Error!\n&quot;</span>);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">//ch:选择设备并创建句柄 | en:select device and create handle</span></div><div class="line">        nRet = <a name="a54"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#gaf10f0644caa6d4dd39fd8c14f8736153">MV_CC_CreateHandle</a>(&amp;handle, stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;MV_CC_CreateHandle fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">//ch:打开设备 | en:open device</span></div><div class="line">        nRet = <a name="a55"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga308c9a9869be7a457d27aadd94ce57dd">MV_CC_OpenDevice</a>(handle);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;MV_CC_OpenDevice fail! nRet [%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        isDevOpen = <span class="keyword">true</span>;</div><div class="line">        <span class="comment">// ch:探测网络最佳包大小(只对GigE相机有效) | en:Detection network optimal package size(It only works for the GigE camera)</span></div><div class="line">        <span class="keywordflow">if</span> (stDeviceList.<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o___l_i_s_t.html#ac8a3f91cd4d9e7f09ff4abaac031dffc">pDeviceInfo</a>[nIndex]-&gt;<a class="code" href="struct_m_v___c_c___d_e_v_i_c_e___i_n_f_o.html#a3b26b1c9681dba57af81bdb7ed795575">nTLayerType</a> == <a class="code" href="group___xE5_xAE_x8F_xE5_xAE_x9A_xE4_xB9_x89.html#gae1780ad0d41bcd2e835ab81155b398e6">MV_GIGE_DEVICE</a>)</div><div class="line">        {</div><div class="line">            <span class="keywordtype">int</span> nPacketSize = <a name="a56"></a><a class="code" href="group___gig_e_xE7_x9B_xB8_xE6_x9C_xBA.html#ga9df4e6a7acbd6e6a6952e01949efc18b">MV_CC_GetOptimalPacketSize</a>(handle);</div><div class="line">            <span class="keywordflow">if</span> (nPacketSize &gt; 0)</div><div class="line">            {</div><div class="line">                nRet = <a name="a57"></a><a class="code" href="group___xE5_xB1_x9E_xE6_x80_xA7_xE9_x85_x8D_xE7_xBD_xAE.html#ga9bf0ac21078791974fd4f5b8b2c6328b">MV_CC_SetIntValueEx</a>(handle,<span class="stringliteral">&quot;GevSCPSPacketSize&quot;</span>,nPacketSize);</div><div class="line">                <span class="keywordflow">if</span>(nRet != MV_OK)</div><div class="line">                {</div><div class="line">                    printf(<span class="stringliteral">&quot;Warning: Set Packet Size fail nRet [0x%x]!\n&quot;</span>, nRet);</div><div class="line">                }</div><div class="line">            }</div><div class="line">            <span class="keywordflow">else</span></div><div class="line">            {</div><div class="line">                printf(<span class="stringliteral">&quot;Warning: Get Packet Size fail nRet [0x%x]!\n&quot;</span>, nPacketSize);</div><div class="line">            }</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">//ch:设置触发模式为off | en:set trigger mode as off</span></div><div class="line">        nRet = <a name="a58"></a><a class="code" href="group___xE5_xB1_x9E_xE6_x80_xA7_xE9_x85_x8D_xE7_xBD_xAE.html#ga15a8abe28a1c5a53e10d115c7def4089">MV_CC_SetEnumValue</a>(handle, <span class="stringliteral">&quot;TriggerMode&quot;</span>, 0);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;MV_CC_SetTriggerMode fail! nRet [%x]!\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">// ch:获取数据包大小 | en:Get payload size</span></div><div class="line">        <a name="_a59"></a><a class="code" href="struct_m_v_c_c___i_n_t_v_a_l_u_e___e_x.html">MVCC_INTVALUE_EX</a> stParam;</div><div class="line">        memset(&amp;stParam, 0, <span class="keyword">sizeof</span>(<a name="_a60"></a><a class="code" href="struct_m_v_c_c___i_n_t_v_a_l_u_e.html">MVCC_INTVALUE</a>));</div><div class="line">        <span class="comment">//使用camera新的接口</span></div><div class="line">        nRet = <a name="a61"></a><a class="code" href="group___xE5_xB1_x9E_xE6_x80_xA7_xE9_x85_x8D_xE7_xBD_xAE.html#ga6240aac97e206f77b4ce3bd7a1ef1048">MV_CC_GetIntValueEx</a>(handle, <span class="stringliteral">&quot;PayloadSize&quot;</span>, &amp;stParam);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Get PayloadSize fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nPayloadSize = stParam.<a name="a62"></a><a class="code" href="struct_m_v_c_c___i_n_t_v_a_l_u_e___e_x.html#a75858d445833ad0bbe60edfa610f7f7b">nCurValue</a>;</div><div class="line"></div><div class="line">        <span class="comment">// ch:开始取流 | en:Start grab image</span></div><div class="line">        nRet = <a name="a63"></a><a class="code" href="group___xE5_x9B_xBE_xE5_x83_x8F_xE9_x87_x87_xE9_x9B_x86.html#ga78728211c47c6f118110fde635d6ac69">MV_CC_StartGrabbing</a>(handle);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Start Grabbing fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <a name="_a64"></a><a class="code" href="struct_m_v___f_r_a_m_e___o_u_t.html">MV_FRAME_OUT</a> stImageInfo = {0};</div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nImageNum = 10;</div><div class="line">        <span class="keywordtype">char</span> chImageName[IMAGE_NAME_LEN] = {0};</div><div class="line">        <a name="_a65"></a><a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html">MV_CC_HB_DECODE_PARAM</a> stDecodeParam = {0};</div><div class="line"></div><div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; nImageNum; i++)</div><div class="line">        {</div><div class="line">            nRet = <a name="a66"></a><a class="code" href="group___xE5_x9B_xBE_xE5_x83_x8F_xE9_x87_x87_xE9_x9B_x86.html#ga33331585a4e2a64653b74af66157a6d8">MV_CC_GetImageBuffer</a>(handle, &amp;stImageInfo, 1000);</div><div class="line">            <span class="keywordflow">if</span>(MV_OK == nRet)</div><div class="line">            {</div><div class="line">                printf(<span class="stringliteral">&quot;Get One Frame: Width[%d], Height[%d], FrameNum[%d], PixelFormat[0x%x]\n&quot;</span>, </div><div class="line">                    stImageInfo.<a name="a67"></a><a class="code" href="struct_m_v___f_r_a_m_e___o_u_t.html#a2587481f4ebfe4e2dcc78f073978772a">stFrameInfo</a>.<a name="a68"></a><a class="code" href="struct_m_v___f_r_a_m_e___o_u_t___i_n_f_o___e_x.html#a523c75b72da2a3bb32b97032f86c4703">nWidth</a>, stImageInfo.<a class="code" href="struct_m_v___f_r_a_m_e___o_u_t.html#a2587481f4ebfe4e2dcc78f073978772a">stFrameInfo</a>.<a name="a69"></a><a class="code" href="struct_m_v___f_r_a_m_e___o_u_t___i_n_f_o___e_x.html#a33071a62b54a3c9a671a0fcbe4804f1a">nHeight</a>, stImageInfo.<a class="code" href="struct_m_v___f_r_a_m_e___o_u_t.html#a2587481f4ebfe4e2dcc78f073978772a">stFrameInfo</a>.<a name="a70"></a><a class="code" href="struct_m_v___f_r_a_m_e___o_u_t___i_n_f_o___e_x.html#a6f8d00948b2d76ac8cd65fda0acc2ed6">nFrameNum</a>, stImageInfo.<a class="code" href="struct_m_v___f_r_a_m_e___o_u_t.html#a2587481f4ebfe4e2dcc78f073978772a">stFrameInfo</a>.<a name="a71"></a><a class="code" href="struct_m_v___f_r_a_m_e___o_u_t___i_n_f_o___e_x.html#adea006ae805402cd96d9f8548235da30">enPixelType</a>);</div><div class="line">                nRet = <a name="a72"></a><a class="code" href="group___xE5_x9B_xBE_xE5_x83_x8F_xE9_x87_x87_xE9_x9B_x86.html#gaeff416b2d35df148fa2e63521d8847d3">MV_CC_FreeImageBuffer</a>(handle, &amp;stImageInfo);</div><div class="line">                <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">                {</div><div class="line">                    printf(<span class="stringliteral">&quot;Free ImageBuffer fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">                    <span class="keywordflow">break</span>;</div><div class="line">                }</div><div class="line">               <span class="keywordflow">if</span> (<span class="keyword">false</span> == IsHBPixelFormat(stImageInfo.<a class="code" href="struct_m_v___f_r_a_m_e___o_u_t.html#a2587481f4ebfe4e2dcc78f073978772a">stFrameInfo</a>.<a class="code" href="struct_m_v___f_r_a_m_e___o_u_t___i_n_f_o___e_x.html#adea006ae805402cd96d9f8548235da30">enPixelType</a>))</div><div class="line">               {</div><div class="line">                   printf(<span class="stringliteral">&quot;Not HB Picture!\n&quot;</span>);</div><div class="line">                   <span class="keywordflow">break</span>;</div><div class="line">               }</div><div class="line">                <span class="comment">//ch:无损压缩解码 | en:Lossless compression decoding</span></div><div class="line">                stDecodeParam.<a name="a73"></a><a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html#a01cabcdb6eb04d42ea699fc45bf21375">pSrcBuf</a> = stImageInfo.<a name="a74"></a><a class="code" href="struct_m_v___f_r_a_m_e___o_u_t.html#ad09dec12abbdf5f6b77c47105e7eaaa9">pBufAddr</a>;</div><div class="line">                <span class="comment">//memcpy(stDecodeParam.pSrcBuf,stImageInfo.pBufAddr,stImageInfo.stFrameInfo.nFrameLen);</span></div><div class="line">                stDecodeParam.<a name="a75"></a><a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html#a6860d280bb5b78e359935494d503b469">nSrcLen</a> = stImageInfo.<a class="code" href="struct_m_v___f_r_a_m_e___o_u_t.html#a2587481f4ebfe4e2dcc78f073978772a">stFrameInfo</a>.<a name="a76"></a><a class="code" href="struct_m_v___f_r_a_m_e___o_u_t___i_n_f_o___e_x.html#ad6d9155e189b8aab2a81609a8b33c6dc">nFrameLen</a>;</div><div class="line"></div><div class="line">                <span class="keywordflow">if</span> (NULL == pDstBuf)</div><div class="line">                {</div><div class="line">                    pDstBuf = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *)malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>) * (nPayloadSize));</div><div class="line">                    <span class="keywordflow">if</span> (NULL == pDstBuf)</div><div class="line">                    {</div><div class="line">                        printf(<span class="stringliteral">&quot;malloc pDsrData fail!\n&quot;</span>);</div><div class="line">                        <span class="keywordflow">break</span>;</div><div class="line">                    }</div><div class="line">                }</div><div class="line">                stDecodeParam.<a name="a77"></a><a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html#a1774c62b15df4e2261e1ac46178ebd41">pDstBuf</a> = pDstBuf;</div><div class="line">                stDecodeParam.<a name="a78"></a><a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html#aeb8e45ddda5f6b8657b4cf440e1e6517">nDstBufSize</a> = nPayloadSize;</div><div class="line">                <span class="keywordflow">if</span> (NULL== stDecodeParam.<a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html#a01cabcdb6eb04d42ea699fc45bf21375">pSrcBuf</a>)</div><div class="line">                {</div><div class="line">                    printf(<span class="stringliteral">&quot;stDecodeParam.pSrcBuf is null !\n&quot;</span>);</div><div class="line">                    <span class="keywordflow">break</span>;</div><div class="line">                }</div><div class="line">                <span class="keywordflow">else</span></div><div class="line">                {</div><div class="line">                    nRet = <a name="a79"></a><a class="code" href="group___xE5_x9B_xBE_xE5_x83_x8F_xE5_xA4_x84_xE7_x90_x86.html#gaf4afd4daffefd78f3b044f26d6151c33">MV_CC_HB_Decode</a>(handle, &amp;stDecodeParam);</div><div class="line">                    <span class="keywordflow">if</span> (nRet != MV_OK)</div><div class="line">                    {</div><div class="line">                        printf(<span class="stringliteral">&quot;Decode fail![0x%x]\n&quot;</span>, nRet);</div><div class="line">                        <span class="keywordflow">break</span>;</div><div class="line">                    }</div><div class="line">                }</div><div class="line">                FILE* fp = NULL;</div><div class="line">                sprintf(chImageName, <span class="stringliteral">&quot;Image_w%d_h%d_fn%03d.raw&quot;</span>, stDecodeParam.<a name="a80"></a><a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html#abbc1b35442c6143931edc0189a3432fb">nWidth</a>, stDecodeParam.<a name="a81"></a><a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html#a2e4c6b811457a16b7033af6741cfb1db">nHeight</a>, stImageInfo.<a class="code" href="struct_m_v___f_r_a_m_e___o_u_t.html#a2587481f4ebfe4e2dcc78f073978772a">stFrameInfo</a>.<a class="code" href="struct_m_v___f_r_a_m_e___o_u_t___i_n_f_o___e_x.html#a6f8d00948b2d76ac8cd65fda0acc2ed6">nFrameNum</a>);</div><div class="line">                fp = fopen(chImageName, <span class="stringliteral">&quot;wb&quot;</span>);</div><div class="line">                <span class="keywordflow">if</span> (NULL == fp)</div><div class="line">                {</div><div class="line">                    printf(<span class="stringliteral">&quot;Open file failed\n&quot;</span>);</div><div class="line">                    <span class="keywordflow">break</span>;</div><div class="line">                }</div><div class="line">                fwrite(stDecodeParam.<a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html#a1774c62b15df4e2261e1ac46178ebd41">pDstBuf</a>, 1, stDecodeParam.<a name="a82"></a><a class="code" href="struct_m_v___c_c___h_b___d_e_c_o_d_e___p_a_r_a_m.html#a815c23e862d53adcaf5f92b2ff37bffd">nDstBufLen</a>, fp);</div><div class="line">                fclose(fp);</div><div class="line">                printf(<span class="stringliteral">&quot;Decode succeed\n&quot;</span>);</div><div class="line">            }</div><div class="line">            <span class="keywordflow">else</span></div><div class="line">            {</div><div class="line">                printf(<span class="stringliteral">&quot;Get Image fail! nRet[0x%x]\n&quot;</span>, nRet);</div><div class="line">            }</div><div class="line">        }</div><div class="line"></div><div class="line">        PressEnterToExit();</div><div class="line"></div><div class="line">        <span class="comment">// ch:停止取流 | en:Stop grab image</span></div><div class="line">        nRet = <a name="a83"></a><a class="code" href="group___xE5_x9B_xBE_xE5_x83_x8F_xE9_x87_x87_xE9_x9B_x86.html#gae5d7f4ae46a53851f104e26fa449ab06">MV_CC_StopGrabbing</a>(handle);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Stop Grabbing fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">// ch:关闭设备 | en:Close device</span></div><div class="line">        nRet = <a name="a84"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga33853bd328f46492102246ca8b645d57">MV_CC_CloseDevice</a>(handle);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Close Device fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        isDevOpen = <span class="keyword">false</span>;</div><div class="line">        <span class="comment">// ch:销毁句柄 | en:Destroy handle</span></div><div class="line">        nRet = <a name="a85"></a><a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga0f74372a22e8a19fa7e21dad45070428">MV_CC_DestroyHandle</a>(handle);</div><div class="line">        <span class="keywordflow">if</span> (MV_OK != nRet)</div><div class="line">        {</div><div class="line">            printf(<span class="stringliteral">&quot;Destroy Handle fail! nRet [0x%x]\n&quot;</span>, nRet);</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        handle = NULL;</div><div class="line">    } <span class="keywordflow">while</span> (0);</div><div class="line">    <span class="comment">//释放内存</span></div><div class="line">    <span class="keywordflow">if</span>(pDstBuf)</div><div class="line">    {</div><div class="line">        free(pDstBuf);</div><div class="line">        pDstBuf = NULL;</div><div class="line">    }</div><div class="line"></div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (isDevOpen == <span class="keyword">true</span>)</div><div class="line">    {</div><div class="line">        <a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga33853bd328f46492102246ca8b645d57">MV_CC_CloseDevice</a>(handle);</div><div class="line">    }</div><div class="line">    <span class="keywordflow">if</span> (handle != NULL)</div><div class="line">    {</div><div class="line">        <a class="code" href="group___xE7_x9B_xB8_xE6_x9C_xBA_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#ga0f74372a22e8a19fa7e21dad45070428">MV_CC_DestroyHandle</a>(handle);</div><div class="line">        handle = NULL;</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">// ch:反初始化SDK | en:Finalize SDK</span></div><div class="line">    <a name="a86"></a><a class="code" href="group___s_d_k_xE5_x88_x9D_xE5_xA7_x8B_xE5_x8C_x96.html#gafa1820a0da8671fc6f77dc9a7dfa69d3">MV_CC_Finalize</a>();</div><div class="line"></div><div class="line">    printf(<span class="stringliteral">&quot;exit.\n&quot;</span>);</div><div class="line">    </div><div class="line">    <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<div class="footer" style="text-align: right;">
	<hr/>
	<small></small>
</div>
<script>
	// 当前选中的菜单
	var currentMenuItem = document.querySelector('.tablist > li.current > a')
	if (currentMenuItem) { // 子菜单情况
	  window.parent.postMessage({
		navHref: currentMenuItem.href
	  }, '*')
	} else {
	  window.parent.postMessage({
		url: window.location.href
	  }, '*')
	}
  </script>
</body>
</html>